% checkbox.m - make a checkbox with a label
% call: checkbox(tag, label, initvalue, x, y)
% x and y are in character units...
function [handle] = checkbox(tag, label, initvalue, fieldwidth, x, y)

b_ht = 1.7 % standard field height in characters
pad_check=7;
fw2 = length(label)+2;
if(fieldwidth > fw2) fw2 = fieldwidth;
end
h1 = uicontrol('Units','characters', ...
	'ListboxTop',0, ...
   'Position',[x y fw2 b_ht], ...
   'HorizontalAlignment','left', ...
   'String',label, ...
	'Style','text', ...
   'FontSize', 8);
handle = uicontrol('Units','characters', ...
	'ListboxTop',0, ...
   'Position',[x+fieldwidth+1 y 2 b_ht], ...
   'HorizontalAlignment','left', ...
   'Max', 1, ...
	'Min', 0, ...
   'Style','checkbox', ...
   'FontSize', 8, ...
   'Tag',tag);
set(handle, 'Value', initvalue);
return

